# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DriveActivity.V2.Model.Permission do
  @moduledoc """
  The permission setting of an object.

  ## Attributes

  *   `allowDiscovery` (*type:* `boolean()`, *default:* `nil`) - If true, the item can be discovered (e.g. in the user's "Shared with me" collection) without needing a link to the item.
  *   `anyone` (*type:* `GoogleApi.DriveActivity.V2.Model.Anyone.t`, *default:* `nil`) - If set, this permission applies to anyone, even logged out users.
  *   `domain` (*type:* `GoogleApi.DriveActivity.V2.Model.Domain.t`, *default:* `nil`) - The domain to whom this permission applies.
  *   `group` (*type:* `GoogleApi.DriveActivity.V2.Model.Group.t`, *default:* `nil`) - The group to whom this permission applies.
  *   `role` (*type:* `String.t`, *default:* `nil`) - Indicates the [Google Drive permissions role](https://developers.google.com/workspace/drive/web/manage-sharing#roles). The role determines a user's ability to read, write, and comment on items.
  *   `user` (*type:* `GoogleApi.DriveActivity.V2.Model.User.t`, *default:* `nil`) - The user to whom this permission applies.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :allowDiscovery => boolean() | nil,
          :anyone => GoogleApi.DriveActivity.V2.Model.Anyone.t() | nil,
          :domain => GoogleApi.DriveActivity.V2.Model.Domain.t() | nil,
          :group => GoogleApi.DriveActivity.V2.Model.Group.t() | nil,
          :role => String.t() | nil,
          :user => GoogleApi.DriveActivity.V2.Model.User.t() | nil
        }

  field(:allowDiscovery)
  field(:anyone, as: GoogleApi.DriveActivity.V2.Model.Anyone)
  field(:domain, as: GoogleApi.DriveActivity.V2.Model.Domain)
  field(:group, as: GoogleApi.DriveActivity.V2.Model.Group)
  field(:role)
  field(:user, as: GoogleApi.DriveActivity.V2.Model.User)
end

defimpl Poison.Decoder, for: GoogleApi.DriveActivity.V2.Model.Permission do
  def decode(value, options) do
    GoogleApi.DriveActivity.V2.Model.Permission.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DriveActivity.V2.Model.Permission do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
